package com.tenqian.media.service.impl;

import com.tenqian.Result;
import com.tenqian.media.domain.Carousel;
import com.tenqian.media.repository.CarouselRepository;
import com.tenqian.media.service.CarouselService;
import com.tenqian.utils.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class CarouselServiceImpl implements CarouselService {
    @Autowired
    CarouselRepository carouselRepository;

    @Override
    public List<Carousel> findAll() {
        return carouselRepository.findAll();
    }

    @Override
    public Page pageData(Specification<Carousel> specification, Pageable pageable) {
        return null;
    }

    @Override
    public void save(Iterable<Carousel> iterable) {

    }

    @Override
    public Result save(Carousel carousel) {
        return ResultUtil.success(carouselRepository.save(carousel));
    }

    @Override
    public Carousel findByPath(String path) {
        return carouselRepository.findByPath(path);
    }
}
